
# bin/bash
# judge the cout of the parm 
parm_count=$#
echo $parm_count'个参数'

host='localhost'
port=0

if [ $# -eq 1 ];
then
port=$1    
fi

if [ $# -eq 2 ];
then
    host=$1
    port=$2
fi


let i=0
while [ $i -lt 1 ] 
do
    a=`lsof -i:$port | wc -l`
    if [ "$a" -gt "0" ];then
        echo  $port'端口占用'
       let port=$port+1
        
    else
        echo  $port'端口未占用'
        i=1 
    fi
done


echo $port '选中'
